
<script
	type="text/javascript"
	src="<?php echo Yii::app()->request->baseUrl;?>/external/tiny_mce/jquery.tinymce.js"></script>
<script type="text/javascript">
$().ready(function() {
	$('#wysiwyg').tinymce({

		// Location of TinyMCE script
		script_url : '<?php echo Yii::app()->request->baseUrl;?>/external/tiny_mce/tiny_mce.js',

		// General options
		mode : "textareas",
		theme : "advanced",
		plugins :"media,table",
		// Theme options
		theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,formatselect,bullist,numlist,|,link,unlink,|,forecolor",
		theme_advanced_buttons2 : "tablecontrols,media,image",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_resizing : true,
		content_css : "<?php echo Yii::app()->request->baseUrl;?>/external/tiny_mce/custom_content.css"
	});
});

</script>

<?php echo CHtml::form('','post',array("data-ajax"=>"false","id"=>"namecardForm",'class'=>'form-horizontal','enctype'=>'multipart/form-data')); ?>
<fieldset class='div div-plain'>
	<h2 class='div'><?php echo $event->isNewRecord?"创建":"编辑"?>活动</h2>
	<?php echo CHtml::activeHiddenField($event, "id");?>
	<div class="control-group">
		<label class='control-label'><?php echo  CActiveForm::labelEx($event,'title');?>
		</label>
		<div class="controls">
			<?php echo CHtml::activeTextField($event,"title");?>
			<?php if($event->getError("title")):?>
			<span class="label important"><?php echo $event->getError("title")?>
			</span>
			<?php endif;?>
		</div>
	</div>

	<div class="control-group">
		<label class='control-label'><?php echo  CActiveForm::labelEx($event,'location');?>
		</label>
		<div class="controls">
			<?php echo CHtml::activeTextField($event,"location");?>
			<?php if($event->getError("location")):?>
			<span class="label important"><?php echo $event->getError("location")?>
			</span>
			<?php endif;?>
		</div>
	</div>



	<div class="control-group">
		<label class='control-label'><?php echo  CActiveForm::labelEx($event,'start');?>
		</label>
		<div class="controls">
			<?php $this->widget('application.extensions.timepicker.timepicker', array(
					'model'=>$event,
					'name'=>'start',
		   )); ?>
			<?php if($event->getError("start")):?>
			<span class="label important"><?php echo $event->getError("start")?>
			</span>
			<?php endif;?>
		</div>
	</div>

	<div class="control-group">
		<label class='control-label'><?php echo  CActiveForm::labelEx($event,'end');?>
		</label>
		<div class="controls">
			<?php $this->widget('application.extensions.timepicker.timepicker', array(
					'model'=>$event,
					'name'=>'end',
		   )); ?>
			<?php if($event->getError("end")):?>
			<span class="label important"><?php echo $event->getError("end")?> </span>
			<?php endif;?>
		</div>
	</div>

	<div class="control-group">
		<label class='control-label'><?php echo  CActiveForm::labelEx($event,'category_id');?>
		</label>
		<div class="controls">
			<?php echo CActiveForm::dropDownList($event,'category_id',CHtml::listData(Category::model()->findAll(),'id','title'), array('prompt'=>'请选择分类')); ?>

			<?php if($event->getError("category_id")):?>
			<span class="label important"><?php echo $event->getError("category_id")?>
			</span>
			<?php endif;?>
		</div>
	</div>
	<div class="control-group">
		<label class='control-label'><?php echo  CActiveForm::labelEx($event,'limit');?>
		</label>
		<div class="controls">
			<?php echo CHtml::activeTextField($event,'limit'); ?>
			<?php if($event->getError("limit")):?>
			<span class="label important"><?php echo $event->getError("limit")?>
			</span>
			<?php endif;?>
		</div>
	</div>
	<div class="control-group">
		<label class='control-label'><?php echo  CActiveForm::labelEx($event,'content');?>
		</label>
		<div class="controls">
			<?php echo CHtml::activeTextArea($event,"content",array("style"=>'width:480px;height:400px;','id'=>'wysiwyg'));?>
			<?php if($event->getError("content")):?>
			<span class="label important"><?php echo $event->getError("content")?>
			</span>
			<?php endif;?>
		</div>
	</div>

	<div class="control-group">
		<label class='control-label'>活动封面</label>
		<div class="controls">
			<?php
			echo CHtml::image(Utils::getImageUrlById("cover", "thumbnail", $event->id),$event->title,array('class'=>"thumbnail"));
			?>
			<br /> <br />
			<?php echo CHtml::activeFileField($event, 'cover'); ?>

		</div>
	</div>


	<div class="form-actions">
		<input type="submit" value="创建活动" class="btn btn-primary">
	</div>
</fieldset>
<?php echo CHtml::endForm(); ?>